<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>首页</title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
	<link href="./css/mui.css" rel="stylesheet"/>
	<link href="./css/mui.min.css" rel="stylesheet"/>
	<link href="./css/mui-icons-extra.css" rel="stylesheet"/>
	<link href="./css/app.css" rel="stylesheet"/>
	<style type="text/css">
	</style>
</head>
<body>
	<!-- 头部HEADER -->
	<header class="app-header">
		<b>最新</b>
		&nbsp; &nbsp; 
		<span onclick="jumpToIndexHistory()">足迹</span>
	</header>
	<!-- 头部HEADER -->
	
	<!-- 首页视频布局 -->
	<div class="app-video-bg" id="refresh">
		<div class="app-video" id="vvv">
			<!-- <video poster="" src="_downloads/传说中的海市蜃楼可以在身边，你要你愿意！.mp4" type="video/mp4" name="media" controls="1" controlsList="nodownload" preload="auto" id="video-1" class="app-video-tag"></video> -->
			<div class="app-video-title">视频标题</div>
			<div class="app-video-menu">
				<span class="mui-icon-extra mui-icon-extra-heart-filled app-video-grey"></span>
				<div class="app-video-grey">0</div>
				<div style="height: 8px;"></div>
				<span class="mui-icon mui-icon-chat app-video-grey"></span>
			</div>
		</div>
		<textarea id="vtmp" style="width:100%;"></textarea>
	</div>
	<!-- 更多按钮 -->
	<p id="more">
		<!-- <button type="button" class="mui-btn mui-btn-block" style="background: ;" onclick="getIndex()">点击更多</button> -->
	</p>
	<br><br>
	<!-- 首页视频布局 -->
	
	<!-- 底部菜单 -->
	<nav class="mui-bar mui-bar-tab">
		<a class="mui-tab-item mui-active" onclick="jumpToIndex()">
			<span class="mui-icon mui-icon-home"></span>
			<span class="mui-tab-label">首页</span>
		</a>
		<a class="mui-tab-item" onclick="jumpToMarket()">
			<span class="mui-icon mui-icon-download"></span>
			<span class="mui-tab-label">库</span>
		</a>
<!-- 		<a class="mui-tab-item" onclick="jumpToChat()">
			<span class="mui-icon mui-icon-chatbubble"></span>
			<span class="mui-tab-label">消息</span>
		</a> -->
		<a class="mui-tab-item" onclick="jumpToMy()">
			<span class="mui-icon mui-icon-contact"></span>
			<span class="mui-tab-label">我的</span>
		</a>
	</nav>
	<!-- 底部菜单 -->
</body>
</html>


<script src="./js/mui.js"></script>
<script src="./js/app.js"></script>
<script type="text/javascript">
	// mui.init();
	//自动加载
	(function($, owner) {
		mui.plusReady(function () {
			// dBase();
			createDownload();
		})
	}(mui, window.app = {}));
	// 判断下载
	function createDownload(){
	        var isFile1 = false;
	        //判断文件是否已经下载
	        plus.io.resolveLocalFileSystemURL(
	            '_downloads/tmp.png',
	            function(entry){
	                if(entry.isFile){
						mui('#vvv')[0].innerHTML = '<img src="'+entry.fullPath+'" width="100%"/>';
						mui('#vtmp')[0].innerHTML = entry.fullPath; 
	                    mui.toast(entry.fullPath+'已经下载');
	                }
	            },
				// mui.toast('11')
	            function(e){dBase();}
	        );
	}
	// 下载动作
	function dBase(){
	    dtask = plus.downloader.createDownload(
	        'http://tsh.fuzhuangchangongxiao.cn/uploads/20200221/tmp.png',
	        {method:"GET"},
	        //下载完成执行的回调函数
	        function(d, status){
				mui('#vvv')[0].innerHTML = '<img src="'+d.filename+'"/>';
	            mui.toast(d.filename);
	        }
	    );
	    dtask.addEventListener("statechanged", function(task,status){
	        if(!dtask){return;}
	        switch(task.state) {
	            case 1: // 开始
	                mui.toast("开始下载...");
	            break;
	            case 2: // 已连接到服务器
	                mui.toast( "链接到服务器...");
	            break;
	            case 3:    // 已接收到数据
					mui.toast((task.downloadedSize/task.totalSize)*100+'%');
	            break;
	            case 4:    // 下载完成
	                mui.toast( "下载完成！");
	            break;
	        }
	    });
	    dtask.start();
	}
</script>